package day1_1.Company1;

import java.util.*;

public class Company {
    //公司有公司名称，注册地址，电话，经营范围等属性
    private String name;
    private String dizhi;
    private String dianhua;
    private String b;

//    Employees[] ar = new Employees[10];
//    List<Employees> list;

    List<Employees> list=new ArrayList<>();

public void chakan(){
    for (Employees employees : list) {
        System.out.println(employees.toString());
    }
//    list.add(new Employees("张三",30,"男","程序员",9000,"44684641116"));
}
    //添加新员工
    public boolean tianjia(String name, int age, String gender, String position, int salary, String number){
        for (Employees employees : list) {
            if (employees.getNumber().equals(number)) {
                return false;
            }
        }

        list.add(new Employees(name,age,gender,position,salary,number));
        return true;
    }
// 辞退
    public boolean citui(String name){
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getName().equals(name)){
                list.remove(i);

                return true;
            }
        }
    return false;
    }

    //人数
    public void a(){
        System.out.println(list.size());
    }

    public void b(){
    int a=list.get(0).getSalary();
        for (Employees value : list) {
            if (value.getSalary() > a) {
                a = value.getSalary();
            }
        }
        for (Employees employees : list) {
            if (employees.getSalary() == a) {
                System.out.println(employees.toString());
            }
        }
    }
    public void show() {
        System.out.println("公司名称:" + name + "\n注册地址:" + dizhi + "\n联系方式:" + dianhua + "\n经营范围:" + b);
    }
}
